/******************************************************************************
 *                  Shanghai ChipON Micro-Electronic Co.,Ltd
 ******************************************************************************
 *  @File Name        : kf8a100fxx_int.h
 *  @Author           : ChipON AE/FAE Group
 *  @Date             : 2023-12-19
 *  @HW Version       : KF8A100Fxx
 *  @Lib Version      : V2.0.1
 *  @Description      : This file provides the driver for the int module
 ******************************************************************************
 *  Copyright (C) by Shanghai ChipON Micro-Electronic Co.,Ltd
 *  All rights reserved.
 *
 *  This software is copyright protected and proprietary to
 *  Shanghai ChipON Micro-Electronic Co.,Ltd.
 *****************************************************************************/
/******************************************************************************
 *  |Date        |Version  |Author       |Description
 ******************************************************************************
 *  |2023-12-26  |V2.0     |Zhong Yusheng|New creat
 *****************************************************************************/

#ifndef KF8A100FXX_INT_H
#define KF8A100FXX_INT_H

#ifdef __cplusplus
extern "C" {
#endif

/******************************************************************************
 *                      Include Files
 *****************************************************************************/
#include "kf8a100fxx.h"
/******************************************************************************
 *                      Macro or Inline
 *****************************************************************************/
#define INT_SET_AIE(x)  (AIE = (x))
#define INT_SET_PUIE(x) (PUIE = (x))
#define INT_SET_IPEN(x) (IPEN = (x))

#define INT_SET_P0IE(x)   (P0IE = (x))
#define INT_SET_INT0IE(x) (INT0IE = (x))
#define INT_SET_T0IE(x)   (T0IE = (x))

#define INT_SET_PWM1IE_T1IE(x) (PWM1IE = (x))
#define INT_SET_T2IE(x)        (T2IE = (x))
#define INT_SET_PWM2IE(x)      (PWM2IE = (x))
#define INT_SET_INT1IE(x)      (INT1IE = (x))
#define INT_SET_INT2IE(x)      (INT2IE = (x))
#define INT_SET_ADIE(x)        (ADIE = (x))
#define INT_SET_EEIE(x)        (EEIE = (x))

#define INT_SET_SSCIIE(x) (SSCIIE = (x))
#define INT_SET_BCLIE(x)  (BCLIE = (x))
#define INT_SET_CCP5IE(x) (CCP5IE = (x))
#define INT_SET_TX1IE(x)  (TX1IE = (x))
#define INT_SET_RC1IE(x)  (RC1IE = (x))
#define INT_SET_T3IE(x)   (T3IE = (x))

#define INT_SET_P4IE(x)      (P4IE = (x))
#define INT_SET_CCP3IE(x)    (CCP3IE = (x))
#define INT_SET_CCP4IE(x)    (CCP4IE = (x))
#define INT_SET_OSCFAILIE(x) (OSCFAILIE = (x))
#define INT_SET_T4IE(x)      (T4IE = (x))

#define INT_SET_TX2IE(x) (TX2IE = (x))
#define INT_SET_RC2IE(x) (RC2IE = (x))
#define INT_SET_TE2IE(x) (TE2IE = (x))
#define INT_SET_RE2IE(x) (RE2IE = (x))

#define INT_SET_PP0(x)   (PP0 = (x))
#define INT_SET_PINT0(x) (PINT0(x))
#define INT_SET_PT0(x)   (PT0 = (x))

#define INT_SET_PPWM1_PT1(x) (PPWM1 = (x))
#define INT_SET_PT2(x)       (PT2 = (x))
#define INT_SET_PWM2(x)      (PPWM2 = (x))
#define INT_SET_PINT1(x)     (PINT1 = (x))
#define INT_SET_PINT2(x)     (PINT2 = (x))
#define INT_SET_PAD(x)       (PADC = (x))
#define INT_SET_PEE(x)       (PEE = (x))

#define INT_SET_PSSCI(x) (PSSCI = (x))
#define INT_SET_PBCL(x)  (PBCL = (x))
#define INT_SET_PCCP5(x) (PCCP5 = (x))
#define INT_SET_PTX1(x)  (PTX1 = (x))
#define INT_SET_PRC1(x)  (PRC1 = (x))
#define INT_SET_PT3(x)   (PT3 = (x))

#define INT_SET_PP4(x)      (PP4 = (x))
#define INT_SET_PCCP3(x)    (PCCP3 = (x))
#define INT_SET_PCCP4(x)    (PCCP4 = (x))
#define INT_SET_POSCFAIL(x) (POSCFAIL = (x))
#define INT_SET_PT4(x)      (PT4 = (x))

#define INT_SET_PTX2(x) (PTX2 = (x))
#define INT_SET_PRC2(x) (PRC2 = (x))
#define INT_SET_PTE2(x) (PTE2 = (x))
#define INT_SET_PRE2(x) (PRE2 = (x))

#define INT_SET_INT2SE(x) (INT2SE = (x))
#define INT_SET_INT1SE(x) (INT1SE = (x))

#define INT_CLR_P0IF   (P0IF = 0u)
#define INT_CLR_INT0IF (INT0IF = 0u)
#define INT_CLR_T0IF   (T0IF = 0u)

#define INT_CLR_EEIF        (EEIF = 0u)
#define INT_CLR_ADIF        (ADIF = 0u)
#define INT_CLR_INT2IF      (INT2IF = 0u)
#define INT_CLR_INT1IF      (INT1IF = 0u)
#define INT_CLR_PWM2IF      (PWM2IF = 0u)
#define INT_CLR_T2IF        (T2IF = 0u)
#define INT_CLR_PWM1IF_T1IF (PWM1IF = 0u)

#define INT_CLR_SSCIIF (SSCIIF = 0u)
#define INT_CLR_BCLIF  (BCLIF = 0u)
#define INT_CLR_CCP5IF (CCP5IF = 0u)
#define INT_CLR_T3IF   (T3IF = 0u)

#define INT_CLR_P4IF      (P4IF = 0u)
#define INT_CLR_CCP3IF    (CCP3IF = 0u)
#define INT_CLR_CCP4IF    (CCP4IF = 0u)
#define INT_CLR_OSCFAILIF (OSCFAILIF = 0u)
#define INT_CLR_T4IF      (T4IF = 0u)

#define INT_CLR_TE2IF (TE2IF = 0u)
#define INT_CLR_RE2IF (RE2IF = 0u)

#define INT_GET_IPEN IPEN
#define INT_GET_AIE  AIE
#define INT_GET_PUIE PUIE

#define INT_GET_P0IE   P0IE
#define INT_GET_INT0IE INT0IE
#define INT_GET_T0IE   T0IE

#define INT_GET_PWM1IE_T1IE PWM1IE
#define INT_GET_T2IE        T2IE
#define INT_GET_PWM2IE      PWM2IE
#define INT_GET_INT1IE      INT1IE
#define INT_GET_INT2IE      INT2IE
#define INT_GET_ADIE        ADIE
#define INT_GET_EEIE        EEIE

#define INT_GET_SSCIIE SSCIIE
#define INT_GET_BCLIE  BCLIE
#define INT_GET_CCP5IE CCP5IE
#define INT_GET_TX1IE  TX1IE
#define INT_GET_RC1IE  RC1IE
#define INT_GET_T3IE   T3IE

#define INT_GET_P4IE      P4IE
#define INT_GET_CCP3IE    CCP3IE
#define INT_GET_CCP4IE    CCP4IE
#define INT_GET_OSCFAILIE OSCFAILIE
#define INT_GET_T4IE      T4IE

#define INT_GET_TX2IE TX2IE
#define INT_GET_RC2IE RC2IE
#define INT_GET_TE2IE TE2IE
#define INT_GET_RE2IE RE2IE

#define INT_GET_P0IF   P0IF
#define INT_GET_INT0IF INT0IF
#define INT_GET_T0IF   T0IF

#define INT_GET_PWM1IF_T1IF PWM1IF
#define INT_GET_T2IF        T2IF
#define INT_GET_PWM2IF      PWM2IF
#define INT_GET_INT1IF      INT1IF
#define INT_GET_INT2IF      INT2IF
#define INT_GET_ADIF        ADIF
#define INT_GET_EEIF        EEIF

#define INT_GET_SSCIIF SSCIIF
#define INT_GET_BCLIF  BCLIF
#define INT_GET_CCP5IF CCP5IF
#define INT_GET_TX1IF  TX1IF
#define INT_GET_RC1IF  RC1IF
#define INT_GET_T3IF   T3IF

#define INT_GET_P4IF      P4IF
#define INT_GET_CCP3IF    CCP3IF
#define INT_GET_CCP4IF    CCP4IF
#define INT_GET_OSCFAILIF OSCFAILIF
#define INT_GET_T4IF      T4IF

#define INT_GET_TE2IF TE2IF
#define INT_GET_RE2IF RE2IF
#define INT_GET_TX2IF TX2IF
#define INT_GET_RC2IF RC2IF

#define INT_GET_PP0   PP0
#define INT_GET_PINT0 PINT0
#define INT_GET_PT0   PT0

#define INT_GET_PPWM1_PT1 PPWM1
#define INT_GET_PT2       PT2
#define INT_GET_PWM2      PPWM2
#define INT_GET_PINT1     PINT1
#define INT_GET_PINT2     PINT2
#define INT_GET_PAD       PADC
#define INT_GET_PEE       PEE

#define INT_GET_PSSCI PSSCI
#define INT_GET_PBCL  PBCL
#define INT_GET_PCCP5 PCCP5
#define INT_GET_PTX1  PTX1
#define INT_GET_PRC1  PRC1
#define INT_GET_PT3   PT3

#define INT_GET_PP4      PP4
#define INT_GET_PCCP3    PCCP3
#define INT_GET_PCCP4    PCCP4
#define INT_GET_POSCFAIL POSCFAIL
#define INT_GET_PT4      PT4

#define INT_GET_PTX2 PTX2
#define INT_GET_PRC2 PRC2
#define INT_GET_PTE2 PTE2
#define INT_GET_PRE2 PRE2

/*****************************************************************************
 *                      Typedef Definitions
 *****************************************************************************/
typedef uint8_t Int_Flag;

typedef enum
{
    INT_P0IF   = 0x01u,
    INT_INT0IF = 0x02u,
    INT_T0IF   = 0x04u,
    INT_P0IE   = 0x08u,
    INT_INT0IE = 0x10u,
    INT_T0IE   = 0x20u,
} Int_InlIntType;

typedef enum
{
    INT_PWM1IE_T1IE = 0x01u,
    INT_T2IE        = 0x02u,
    INT_PWM2IE      = 0x04u,
    INT_INT1IE      = 0x10u,
    INT_INT2IE      = 0x20u,
    INT_ADIE        = 0x40u,
    INT_EEIE        = 0x80u
} Int_Eie1Type;

typedef enum
{
    INT_SSCIIE = 0x01u,
    INT_BCLIE  = 0x02u,
    INT_CCP5IE = 0x04u,
    INT_TX1IE  = 0x10u,
    INT_RC1IE  = 0x20u,
    INT_T3IE   = 0x80u
} Int_Eie2Type;

typedef enum
{
    INT_P4IE      = 0x02u,
    INT_CCP3IE    = 0x08u,
    INT_CCP4IE    = 0x10u,
    INT_OSCFAILIE = 0x20u,
    INT_T4IE      = 0x80u
} Int_Eie3Type;

typedef enum
{
    INT_TX2IE = 0x01u,
    INT_RC2IE = 0x02u,
    INT_TE2IE = 0x04u,
    INT_RE2IE = 0x08u
} Int_Eie4Type;

typedef enum
{
    INT_PWM1IF_T1IF = 0x01u,
    INT_T2IF        = 0x02u,
    INT_PWM2IF      = 0x04u,
    INT_INT1IF      = 0x10u,
    INT_INT2IF      = 0x20u,
    INT_ADIF        = 0x40u,
    INT_EEIF        = 0x80u
} Int_Eif1Type;

typedef enum
{
    INT_SSCIIF = 0x01u,
    INT_BCLIF  = 0x02u,
    INT_CCP5IF = 0x04u,
    INT_T3IF   = 0x80u
} Int_Eif2Type;

typedef enum
{
    INT_P4IF      = 0x02u,
    INT_CCP3IF    = 0x08u,
    INT_CCP4IF    = 0x10u,
    INT_OSCFAILIF = 0x20u,
    INT_T4IF      = 0x80u
} Int_Eif3Type;

typedef enum
{
    INT_TE2IF = 0x04u,
    INT_RE2IF = 0x08u
} Int_Eif4Type;

typedef enum
{
    INT_PP0   = 0x01u,
    INT_PINT0 = 0x02u,
    INT_PT0   = 0x04u,
} Int_Ip0Type;

typedef enum
{
    INT_PPWM1_PT1 = 0x01u,
    INT_PT2       = 0x02u,
    INT_PWM2      = 0x04u,
    INT_PINT1     = 0x10u,
    INT_PINT2     = 0x20u,
    INT_PAD       = 0x40u,
    INT_PEE       = 0x80u
} Int_Ip1Type;

typedef enum
{
    INT_PSSCI = 0x01u,
    INT_PBCL  = 0x02u,
    INT_PCCP5 = 0x04u,
    INT_PTX1  = 0x10u,
    INT_PRC1  = 0x20u,
    INT_PT3   = 0x80u
} Int_Ip2Type;

typedef enum
{
    INT_PP4      = 0x02u,
    INT_PCCP3    = 0x08u,
    INT_PCCP4    = 0x10u,
    INT_POSCFAIL = 0x20u,
    INT_PT4      = 0x80u
} Int_Ip3Type;

typedef enum
{
    INT_PTX2 = 0x01u,
    INT_PRC2 = 0x02u,
    INT_PTE2 = 0x04u,
    INT_PRE2 = 0x08u
} Int_Ip4Type;

typedef enum
{
    INT_DISABLE = 0u,
    INT_ENABLE  = 1u
} Int_EnType;

typedef enum
{
    INT_PRIORITY_LOW  = 0u,
    INT_PRIORITY_HIGH = 1u
} Int_PrioType;

typedef enum
{
    INT_FALLING_TRIG = 0u,
    INT_RISING_TRIG  = 1u
} Int_EdgType;
/******************************************************************************
 *                      Export Variables
 *****************************************************************************/

/******************************************************************************
 *                      Export Functions
 *****************************************************************************/

#ifdef __cplusplus
}
#endif

#endif
/* EOF */
